package com.yy.controller;


import com.github.pagehelper.PageInfo;
import com.yy.domain.GptDoctorValueEvaluationDO;
import com.yy.domain.ResponseResult;
import com.yy.dto.GptDoctorEvaluationDTO;
import com.yy.service.GptDoctorEvaluationService;
import com.yy.vo.DoctorPageVO;
import com.yy.vo.EvaluationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 姚欣宏
 * @since 2023-11-09
 */
@Slf4j
@Api(tags = "医生评价相关接口")
@RestController
@RequestMapping("/gpt_doctor/api/v1")
public class GptDoctorEvaluationController {

    @Autowired
    GptDoctorEvaluationService gptDoctorEvaluationService;

    @ApiOperation("任务列表")
    @PostMapping("/gpt")
    public ResponseResult<PageInfo<GptDoctorEvaluationDTO>> getGptDoctors(@RequestBody DoctorPageVO doctorPageVO) {
        PageInfo<GptDoctorEvaluationDTO> pageInfo = gptDoctorEvaluationService.getGptDoctors(doctorPageVO);
        return new ResponseResult<>(200, "请求成功", pageInfo);
    }

    @ApiOperation("任务详情")
    @GetMapping("/gpt_one")
    public ResponseResult<GptDoctorEvaluationDTO> getGptDoctor(@RequestParam Integer id) {
        GptDoctorEvaluationDTO gptDoctorEvaluationDTO = gptDoctorEvaluationService.getGptDoctor(id);
        return new ResponseResult<>(200, "请求成功", gptDoctorEvaluationDTO);
    }

    @ApiOperation("评价修改")
    @GetMapping("/update_one")
    public ResponseResult<GptDoctorEvaluationDTO> updateOne(@RequestParam Integer id) {
        GptDoctorEvaluationDTO gptDoctorEvaluationDTO = gptDoctorEvaluationService.updateOne(id);
        return new ResponseResult<>(200, "请求成功", gptDoctorEvaluationDTO);
    }


    @ApiOperation("创建评价")
    @PostMapping("/add_valuate")
    public ResponseResult<Integer> insertEvaluate(@RequestBody EvaluationVO evaluationVO) {
        Integer id = gptDoctorEvaluationService.insertEvaluate(evaluationVO);
        return new ResponseResult<>(200, "保存成功", id);
    }


    @ApiOperation("单个评价详情")
    @GetMapping("/gpt_value_one")
    public ResponseResult<GptDoctorValueEvaluationDO> getGptDoctorOne(@RequestParam Integer gptSort, @RequestParam Integer gptCtId) {
        GptDoctorValueEvaluationDO gptDoctorValueEvaluationDO = gptDoctorEvaluationService.getGptDoctorOne(gptSort, gptCtId);
        return new ResponseResult<>(200, "请求成功", gptDoctorValueEvaluationDO);
    }


}

